import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'
import getters from './getters'
import app from './modules/app'
import settings from './modules/settings'
import user from './modules/user'
import videoData from './modules/videoData'

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    app,
    settings,
    user,
    videoData
  },
  getters,
  plugins: [
    createPersistedState({
      key: 'userInfo',
      paths: ['user.token'],
      reducer(value) {
        return value
      }
    })
  ]
})

export default store
